<?php
require_once 'base_model.php';
class Product extends Base_model {

	protected $message;
	function __construct() {
		parent::__construct();
		$this->tablename = 'tbproduct';

	}
	function general() {
		function general() {

			$data['title'] = 'Title';
			$data['author'] = 'Author';
			$data['publisher'] = 'Publisher';
			$data['year'] = 'Year';
			$data['years'] = array('2007' => '2007', '2008' => '2008',
					'2009' => '2009');
			$data['available'] = 'Available';

			return $data;
		}
	}
	function get_products_by_category_id($category_id) {

		return $this->fetch(array("category_id" => $category_id));
	}
	function  delete_by_id($id)
	{
		$this->db->where("product_id",$id);
		 $this->db->delete($this->tablename);
	}
	function add_product($array)
	{
		if($this->add($array))
		{
			throw new Exception('Add product successful');
		}
		else 
		{
			throw new Exception('Add product un-successful');
		}
		
	}

}

/*)
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
